package com.jsy.mini12306.order.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.jsy.mini12306.common.entity.Station;
import com.jsy.mini12306.common.entity.TicketOrderIterm;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author: SongyangJi
 * @description:
 * @since: 2021/9/9
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TicketOrderVO {
    /**
     * 订单id（雪花）
     */
    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using= ToStringSerializer.class)
    private Long orderId;
    /**
     * 旅客id
     */
    private Long buyerId;
    /**
     * 下单日期时间
     */
    private LocalDateTime dateTime;
    /**
     * 车次id
     */
    private Integer trainId;
    /**
     * 发车时间
     */
    private LocalDate departDate;
    /**
     * 起点站
     */
    private Station startStation;
    /**
     * 终点站
     */
    private Station endStation;
    /**
     * 列车次（冗余）
     */
    private String trainName;
    /**
     * 订单号
     */
    private Integer orderNum;

    @TableField(exist = false)
    private List<TicketOrderItermVO> ticketOrderIterms;
}

/*

{
  "orderId": 72,
  "buyerId": 12,
  "dateTime": "2023-07-04 01:43:39",
  "trainId": 8,
  "departDate": "2026-02-10",
  "startStation": {
    "serialVersionUID": 14,
    "stationId": 27,
    "stationName": "fake_data",
    "city": "fake_data",
    "address": "fake_data",
    "alphabetical": "fake_data"
  },
  "endStation": {
    "serialVersionUID": 45,
    "stationId": 3,
    "stationName": "fake_data",
    "city": "fake_data",
    "address": "fake_data",
    "alphabetical": "fake_data"
  },
  "trainName": "fake_data",
  "orderNum": 33,
  "ticketOrderIterms": [
    {
      "orderId": 11,
      "passengerId": 58,
      "ticketType": "fake_data",
      "price": 26.54,
      "seatType": "BUSINESS",
      "bin": "fake_data",
      "seat": "fake_data"
    }
  ]
}

 */